
class JQCategoryDeleteService extends global.JQService {
    async do_action(){
		console.log('delete 1111')
		if(!this.conn)console.log('do_action::conn error');
		let data_obj = this.req_obj.data_obj;
		
		let inst_cp = global.JQTableIF.instance('cp_table',this.conn);
		// _addParams
		console.log('delete ' + JSON.stringify(data_obj));
		if(!data_obj || !data_obj.obj || !data_obj.obj.menu_id){
			throw {'code':global.consts.Error.ERROR_PARAM,
				'message':global.consts.Message.ERROR_PARAM};
		}
		
		//let params=super._addBasicParams();
		let params = super._addParams(['menu_id=',data_obj.obj.menu_id],null);
		let one = await inst_cp.queryOne(['cp_id'],params,null,'sort desc');
		
		if(one){
			throw {'code':global.consts.Error.ERROR_DELETE,
				'message':global.consts.Message.ERROR_CATE_DELETE};
		}
		
		
		let inst = global.JQTableIF.instance('menu_table',this.conn);
		console.log('delete 22222')
		let obj =await inst.remove(data_obj.obj.menu_id);
		console.log('delete 22222  ' + obj)
		return obj;			
	}

}
module.exports = JQCategoryDeleteService;

